<?php
/**
 * Created by JetBrains PhpStorm.
 * User: guansong
 * Date: 17/2/22
 * Time: 上午11:36
 * To change this template use File | Settings | File Templates.
 */

namespace app\home\validate;


use think\Validate;

class Newstype extends Validate {
    //验证规则
    protected $rule=[
        'name' => 'require|max:5',//名字必须而且长度<=5
        'id'   => 'require'
    ];
    protected $message=[
        'name.require' =>'类型名称不能为空！',
        'name.max'     => '类型最多5个字符',
        'id'           => ' id 不能为空！'
    ];
    protected $scene= [
        'add'   =>  ['name'],
        'edit'  =>  ['name','id']
    ];
}